<template>
  <view class="product-list">
    <view class="offset">
      <view v-for="(item, index) in list" :key="index">
        <view class="pic">
          <image :src="item.src"></image>
        </view>
        <view class="text">
          <text class="name">{{item.name}}</text>
          <text class="price">¥{{item.price}}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name: "ProductList",
    props: {
      list: {
        type: Array,
        default: () => {
          return []
        }
      }
    },
    data() {
      return {
        
      }
    },
    methods: {
      
    },
  };
</script>

<style lang="scss" scoped>
  .product-list {
    margin-top: 35upx;
    padding-bottom: 30upx;
    
    .offset {
      width: calc(100% + 16upx);
      display: flex;
      flex-wrap: wrap;
      
      > view {
        width: calc(50% - 16upx);
        box-sizing: border-box;
        margin: 0 16upx 16upx 0;
        background-color: #fff;
        border-radius: 10upx;
        overflow: hidden;
        
        .pic {
          width: 100%;
          height: 330upx;
          
          image {
            width: 100%;
            height: 100%;
          }
        }
        
        .text {
          padding: 10upx 20upx 15upx 20upx;
          
          .name {
            color: #444;
            font-size: 28upx;
            line-height: 1;
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
          
          .price {
            color: red;
            font-size: 28upx;
            font-weight: 500;
          }
        }
      }
    }
  }
</style>
